﻿using System.Reflection;
using CoreEx.Database.Query.Expressions;

namespace CoreEx.Database.Linq
{
    /// <summary>
    /// Represents the relationship between a projected column and its <see cref="TargetProperty"/>.
    /// </summary>
    public class ProjectedColumn
    {        
        /// <summary>
        /// Gets or sets the name or alias of the projected column.
        /// </summary>
        public string ColumnName { get; set; }

        /// <summary>
        /// Gets or sets the <see cref="PropertyInfo"/> instance that describes the target property.
        /// </summary>
        public PropertyInfo TargetProperty { get; set; }

        /// <summary>
        /// Gets or sets a <see cref="bool"/> value that indicates if the <see cref="ProjectedColumn"/>
        /// is part of the primary key.
        /// </summary>
        public bool IsPrimaryKeyColumn { get; set; }

        /// <summary>
        /// Gets or sets the <see cref="DbExpression"/> instance that represents projecting this column.
        /// </summary>
        public DbExpression DbExpression { get; set; }
            
    }
}
